package cn.aitstone.system.service.impl;

import cn.aitstone.basic.utils.PageList;
import cn.aitstone.system.domain.DictionaryDetail;
import cn.aitstone.system.mapper.DictionaryDetailMapper;
import cn.aitstone.system.query.DictionaryDetailQuery;
import cn.aitstone.system.service.IDictionaryDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
/**
 * @Description: 数据字典明细实现类
 * @Author: Sheldon
 * @Version: 1.0
 * @Date:  2022/6/30 23:42
 */
@Service
// 只读事务
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class DictionaryDetailServiceImpl implements IDictionaryDetailService {
    @Autowired
    private DictionaryDetailMapper dictionaryDetailMapper
            ;

    @Override
    public List<DictionaryDetail> loadAll() {
        return dictionaryDetailMapper.loadAll();
    }

    @Override
    public DictionaryDetail loadById(Long id) {
        return dictionaryDetailMapper.loadById(id);
    }

    @Override
    @Transactional
    public void remove(Long id) {
        dictionaryDetailMapper.remove(id);
    }

    @Override
    @Transactional
    public void save(DictionaryDetail dictionaryTypeDetail) {
        dictionaryDetailMapper.save(dictionaryTypeDetail);
    }

    @Override
    @Transactional
    public void update(DictionaryDetail dictionaryTypeDetail) {
        dictionaryDetailMapper.update(dictionaryTypeDetail);
    }

    @Override
    public PageList<DictionaryDetail> queryData(DictionaryDetailQuery dictionaryDetailQuery) {
        List<DictionaryDetail> rows = dictionaryDetailMapper.queryData(dictionaryDetailQuery);
        Integer total = dictionaryDetailMapper.queryCount(dictionaryDetailQuery);
        return new PageList<>(total, rows);
    }

    @Override
    @Transactional
    public void batchdel(Long[] ids) {
        dictionaryDetailMapper.batchdel(ids);
    }
}
